home *** CD-ROM | disk | FTP | other *** search
/ .net (French) 1996 November / .net Magazine (FR) - Issue 01 - Nov 1996.iso / mac / Courrier / DPW ƒ / Sorting_Instructions < prev   
Text File  |  1996-01-24  |  9KB  |  195 lines

  1. * Input file for Disgruntled Postal Worker
  2. * Version 1.1╜ ⌐1995 by Jonathan Guyer <j-guyer@nwu.edu>
  3.  
  4. * A mail sorter for Eudora 1.5.1 (and later?)
  5. * (for those of us who are too cheap to buy the commercial version).
  6. * It sorts all mail in the "In" and/or "Out" box, according to an 
  7. * instruction file.
  8.  
  9. * In addition to a basic AppleScript installation, you should only need
  10. * to ensure that Apple's Scripting Additions has been installed 
  11. * (specifically, the "Read/Write Commands" OSAX). 
  12. * DPW does not rely on a Scriptable Finder. 
  13. * The EudoraNotify.osax will help readability, but is not needed for the script 
  14. * to function.
  15.  
  16. * If you make changes to the instruction file, you must quit and restart DPW.
  17. *
  18. * The instruction file must be called "Sorting_Instructions" 
  19. * and be in the same folder as DPW.
  20.  
  21. * Version History:
  22. *   (WARNING!!: this script is so alpha, it's omega.
  23. *               I guarantee/warant/pledge/promise/assure Nothing!!
  24. *               That said, enjoy!)
  25. *
  26. * 1.1╜   3/31/95
  27. *     Enabled sorting of "Out" box
  28. *     Enabled sorting of entire mailbox on startup
  29. *     Renamed flags to hopefully make a little more sense
  30. *     Added a AppleEvent TimeOut delay variable to help ensure that the first 
  31. *       mail on startup gets sorted
  32. *
  33. * 1.0╜3  2/27/95
  34. *     Renamed input file to "Sorting_Instructions"
  35. *     Added #sortAllNewMessages# flag
  36. *     Stopped sorting entire "In" box
  37. *
  38. * 1.0╜2  2/26/95 
  39. *     Moved instructions file from System:Preferences to folder with DPW
  40. *
  41. * 1.0╜   2/24/95
  42. *     Humble beginnings
  43.  
  44. * This script was inspired by example scripts by Chuck Shotton 
  45. * (author of MacHTTP) on the MacHTTP LISTSERVER and from the Qualcomm example 
  46. * scripts file <ftp://www.qualcomm.com/mac/quest/eudora/mac/scripts/>
  47.  
  48. * If Eudora is currently a startup application, it is recommended that this 
  49. * script (or an alias to it) be put in the Startup Items folder instead. 
  50. * This ensures that Disgruntled Postal Worker is stalking the Post Office before 
  51. * any mail comes in (you don't want to get it upset, do you?). 
  52. * Eudora will be launched by DPW.
  53.  
  54. * I've introduced the following flags:
  55.  
  56. #sortUnreadMessagesOnly#
  57.  
  58. * If this flag is present, only unread mail will be sorted, all new mail gets 
  59. * sorted, otherwise all new mail gets sorted. 
  60. * The second case (without the flag) is useful if you 
  61. * receive a lot of mail and you start reading it while DPW is still sorting; 
  62. * this way it will get sorted anyway 
  63. * (although, the message you are reading may get snatched away).
  64.  
  65. * #sortWholeBox#
  66.  
  67. * This flag saves having to run a whole separate script to get your life in 
  68. * order for the first time.
  69. * If this flag is present, the entire mail box ("In" and/or "Out", depending on 
  70. * the next two flags) will get sorted on startup. If #sortUnreadMessagesOnly# is 
  71. * set, then only the unread messages will get sorted. I recommend setting this 
  72. * flag the first time you run DPW and then commenting it out. You shouldn't ever 
  73. * need to use it again, but it's nice to know that it's there just in case 
  74. * something causes your mail to not get sorted.
  75.  
  76. #sortInBox#
  77. #sortOutBox#
  78.  
  79. * These two flags should be pretty self-explanatory. 
  80. * See the following to determine how each box gets sorted.
  81.  
  82.  
  83. * The instructions file consists of a series of tab delimited instructions:
  84. * <IN FIELD> <TAB> <OUT FIELD> <TAB> <STRING> <TAB> <PATH>
  85. *
  86. * <IN FIELD>     is an RFC 822 header field for the "In" box. If Eudora can't 
  87. *             understand it, the instruction is ignored.
  88. * <OUT FIELD> is an RFC 822 header field for the "Out" box. If Eudora can't 
  89. *             understand it, the instruction is ignored.
  90. * <STRING>       is a search string. If <FIELD> of an incoming message contains 
  91. *             <STRING> then the message is moved to the mailbox indicated by 
  92. *             <PATH>.
  93. * <PATH>         consists of [<MAIL FOLDER> <TAB>]<MAILBOX>. <MAIL FOLDER>'s 
  94. *                      can be nested arbitrarily deep. If <PATH> doesn't resolve to 
  95. *             something Eudora knows, the transfer instruction is ignored.
  96.  
  97. * Any line starting with an '*' is considered a comment and is ignored.
  98. * NOTE: You can reduce the load time of this file significantly by removing
  99. *       all of these comment lines. 
  100. *       Make a copy first!!!
  101. *       On my PMac 7100/66 it's the difference between about 17 secs with
  102. *       comments and 2 seconds without. 
  103. *       The time to process sorts will not be affected. 
  104.  
  105. * If more than a few sorts are defined, this can be excruciatingly slow.
  106. * Put the most heavily used ones (like LISTSERVERS) near the top. 
  107. * Does anyone have any suggestions?
  108.  
  109. * I don't know why, but I can't get Eudora to activate properly:
  110. *
  111. * IF  "Settings:Checking Mail:Check for mail every ___ minutes." is not blank 
  112. *      (you have selected automatic mail checking)
  113. * AND "Settings:Checking Mail:Save password" is not checked,
  114. * THEN Eudora sits in the background waiting to be activated and have a 
  115. *      password entered.
  116. * IF  "Settings:Getting Attention:Use an alert." is not checked, 
  117. *      it's quite likely that Eudora will time-out on its password request 
  118. *      before you notice it.
  119. * This isn't a disaster; just not the way I'd like it to work.
  120.  
  121. * To minimize the problems assosciated with the above, I've added a timeout delay, 
  122. * which defaults to 300 seconds, but which can be set by:
  123.  
  124. * #startUpDelay#    300
  125.  
  126. * If the user enters nothing, Eudora's password dialog times out in about
  127. * 2 minutes. The default setting of 5 minutes allows at least 3 minutes to
  128. * download mail after the user enters a password. If the mail download takes
  129. * longer, DPW will report a timeout error, but it will sort the mail anyway.
  130. * If you download lots of messages over a modem line, you might wish to extend
  131. * this delay, just to avoid having to aknowledge DPW's error message.
  132. * I'm not aware that there are any particular repurcussions to setting it 
  133. * longer.
  134. * Anybody??
  135.  
  136. * This flag is only relevant on startup of DPW & Eudora and only if automatic
  137. * mail checking is selected.
  138.  
  139. * Without this delay, the default AppleScript delay of 1 minute caused DPW to
  140. * report a timeout error before Eudora got tired and put its password dialog 
  141. * away. If the user entered a password in the next minute, the mail sometimes 
  142. * did not get sorted (a major pain, I know).
  143.  
  144.  
  145.  
  146.  
  147. * If a message satisfies more than one of the following instructions, it will be 
  148. * sorted according to the first one. Likewise, if a message in the "Out" box is 
  149. * sent to multiple recipients, it will be sorted according to the first match. I 
  150. * may eventually figure out how to not sort multiple-recipient outgoing mail. 
  151. * Any thoughts?
  152.  
  153. * To sort mail from LISTSERVERS, use the sender field. 
  154. * The mail author (From:...) varies, but sender is the LISTSERVER. 
  155. * Will this always work?
  156.  
  157. * So, the first instruction below means that messages in the "In" box that have
  158. * 'owner-machttp-talk@academ.com' in the 'Sender:' field will got sorted to
  159. * 'Lists:MacHTTP:MacHTTP List'. Likewise, messages in the "Out" box that have
  160. * 'owner-machttp-talk@academ.com' in the 'To:' field will get sorted to the
  161. * same mailbox.
  162.  
  163. sender    to    owner-machttp-talk@academ.com    Lists    MacHTTP    MacHTTP list
  164. sender    to    Macintosh Scripting Systems    Lists    MacScript
  165. sender    to    nih-image@soils.umn.edu    Lists    NIH Image
  166.  
  167. * It may arise that the <STRING> for the "In" and "Out" boxes won't be the same.
  168. * Maybe I have a nickname defined such that mail I address to 'MacGod' gets sent 
  169. * to John Norstad, but mail I get from him (I actually do get mail from John, 
  170. * occasionally, and it's cause for much rejoicing by the peasants) is from 
  171. * 'John Norstad'. In this event, I'd need to define two separate
  172. * instructions:
  173.  
  174.     to    MacGod    I'm not worthy    Norstad
  175.  
  176. * and
  177.  
  178. from        John Norstad    I'm not worthy    Norstad
  179.  
  180. * This way, mail both to and from Norstad would get sorted to 
  181. * "I'm not worthy:Norstad" (as opposed to "I'm not worthy:Locklear" or 
  182. * "I'm not worthy:Elvis" (I don't get nearly so much mail from them))
  183.  
  184. * Note the null field at the beginning of the first instruction and
  185. * in the second position of the second instruction.
  186. * Instructions with null fields will be ignored by the sorter, i.e., my
  187. * "In" box will not get searched for messages involving "MacGod".
  188. * In general, it's preferable not to have these double instructions,
  189. * since each instruction takes some time, whether it's implemented or not.
  190.  
  191. * Be very careful with spaces and tabs. DPW won't puke on spaces in your paths,
  192. * but it's almost impossible to tell spaces and tabs apart in SimpleText.
  193. * Tabs are valid field delimiters; spaces are not.
  194. * Spaces are valid characters in any of the fields; tabs are not.
  195.